{{- $requiredClass := "confkey-required" }}{{ $requiredText := "required" }}
{{- with .Get "required" }}
{{- if (eq . "no") }}{{ $requiredClass = "confkey-notrequired" }}{{ $requiredText = "not required" }}
{{- else if (eq . "situational") }}{{ $requiredClass = "confkey-situational" }}{{ $requiredText = "situational" }}
{{ end }}{{- end }}
{{- $type := "string" }}{{ with .Get "type" }}{{ $type = . }}{{ end }}
{{- $syntax := "" }}{{ with .Get "syntax" }}{{ $syntax = . }}{{ end }}
{{- $structure := "" }}{{ with .Get "structure" }}{{ $structure = . }}{{ end }}
{{- $ref := (.Get "common") }}
{{- if not $ref }}
{{- if eq $type "structure" }}
{{- with $structure }}{{ $ref = . }}{{ end }}
{{- else if eq $syntax "duration" }}{{ $ref = "duration" }}
{{- else if eq $syntax "address" }}{{ $ref = "address" }}
{{- else if eq $syntax "network" }}{{ $ref = "network" }}
{{- end }}
{{- end }}
<div class="mb-3">
  {{- range $t := (split $type ",") }}
  <span class="badge confkey-type" data-bs-toggle="tooltip" data-bs-placement="top" title="The value type">{{ $t }}</span>
  {{- end }}
  {{- with $syntax }}
  {{- if $ref }}
  <a href="/configuration/prologue/common/#{{ $ref }}" class="badge confkey-syntax" data-bs-toggle="tooltip" data-bs-placement="top" title="The common syntax name">{{ $syntax }}</a>
  {{- else }}
  <span class="badge confkey-syntax" data-bs-toggle="tooltip" data-bs-placement="top" title="The common syntax name">{{ $syntax }}</span>
  {{- end }}
  {{- end }}
  {{- with $structure }}
  {{- if $ref }}
  <a href="/configuration/prologue/common/#{{ $ref }}" class="badge confkey-syntax" data-bs-toggle="tooltip" data-bs-placement="top" title="The common structure name">{{ $structure }}</a>
  {{- else }}
  <span class="badge confkey-syntax" data-bs-toggle="tooltip" data-bs-placement="top" title="The common structure name">{{ $structure }}</span>
  {{- end }}
  {{- end }}
  {{- with .Get "default" }}
  <span class="badge confkey-default" data-bs-toggle="tooltip" title="The default value">{{ . }}</span>
  {{- end }}
  <span class="badge {{ $requiredClass }}" data-bs-toggle="tooltip" title="If this option is required or not">{{ $requiredText }}</span>
</div>
{{- if $ref }}
{{- $description := "common syntax" }}
{{- $text := "This configuration option uses a common syntax. " }}
{{- if eq $ref "duration" }}
  {{- $description = "Common Syntax: Duration" }}
  {{- $text = "This configuration option uses a common syntax. " }}
{{- else if eq $ref "address" }}
  {{- $description = "Common Syntax: Address" }}
  {{- $text = "This configuration option uses a common syntax. " }}
{{- else if eq $ref "tls" }}
  {{- $description = "Common Structure: TLS" }}
  {{- $text = "This configuration option uses a common structure. " }}
{{- else if eq $ref "server-buffers" }}
  {{- $description = "Common Structure: Server Buffers" }}
  {{- $text = "This configuration option uses a common structure. " }}
{{- else if eq $ref "server-timeouts" }}
  {{- $description = "Common Structure: Server Timeouts" }}
  {{- $text = "This configuration option uses a common structure. " }}
{{- end }}
{{- with .Get "common-description" }}{{ $description := . }}{{ end }}
{{- with .Get "common-text" }}{{ $text := . }}{{ end }}
<div class="callout callout-tip d-flex flex-row mt-4 mb-4 pt-4 pe-4 pb-2 ps-3">
  <svg class="outline/rocket svg-inline callout-icon me-2 mb-3" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 13a8 8 0 017 7 6 6 0 003-5 9 9 0 006-8 3 3 0 00-3-3 9 9 0 00-8 6 6 6 0 00-5 3"></path><path d="M7 14a6 6 0 00-3 6 6 6 0 006-3"></path><path d="M15 9m-1 0a1 1 0 102 0 1 1 0 10-2 0"></path></svg>
  <div class="callout-content">
    <div class="callout-title">
      <p>Reference Note</p>
    </div>
    <div class="callout-body">
      <p>{{ $text }}For more information please see both the <a href="#configuration">configuration example</a> and the <a href="/configuration/prologue/common/#{{ $ref }}">{{ $description }}</a> reference guide.</p>
    </div>
  </div>
</div>
{{- end }}
{{- with .Get "secret" }}
{{- if eq . "yes" }}
<div class="callout callout-caution d-flex flex-row mt-4 mb-4 pt-4 pe-4 pb-2 ps-3">
  <svg class="outline/alert-triangle svg-inline callout-icon me-2 mb-3" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 9v4"></path><path d="M10.363 3.591 2.257 17.125a1.914 1.914.0 001.636 2.871h16.214a1.914 1.914.0 001.636-2.87L13.637 3.59a1.914 1.914.0 00-3.274.0z"></path><path d="M12 16h.01"></path></svg>
  <div class="callout-content">
    <div class="callout-title">
      <p>Important Note</p>
    </div>
    <div class="callout-body">
      <p>This can also be defined using a <a href="/configuration/methods/secrets/">secret</a> which is <strong>strongly recommended</strong> especially for containerized deployments.</p>
    </div>
  </div>
</div>
{{- end }}
{{- end }}
